import ajax from './ajax'

// 修改用户信息
export const reqProfileInfo = (userObj) => {
  return ajax({
    url: '/api/user',
    method: 'put',
    data:{
      user: userObj
    },
    headers:{
      needToken: true
    }
  })
}

// 获取用户信息
export const reqGetUserInfo = (username) => {
  return ajax({
    url: `/api/profiles/${username}`,
    method: 'get',
    headers:{
      needToken: true
    }
  })
}

// 关注作者
export const reqFollowAuthor = (username) => {
  return ajax({
    url: `/api/profiles/${username}/follow`,
    method: 'post',
    headers:{
      needToken: true
    }
  })
}

// 取关作者
export const reqUnFollowAuthor = (username) => {
  return ajax({
    url: `/api/profiles/${username}/follow`,
    method: 'delete',
    headers:{
      needToken: true
    }
  })
}